home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / clipper / nannws34.zip / CONORDER.PRG next >
Text File  |  1989-01-01  |  1KB  |  62 lines

  1. * Program: Conorder.prg
  2. * Author:  Diane Lask
  3. * Version: Clipper Summer '87
  4. * Note(s): Tests and demonstrates the use of
  5. *          conditionally-ordered indexing.
  6. *
  7. * Copyright (c) 1988 Nantucket Corp.
  8.  
  9.  
  10. * Create a character memory variable to hold your condition.
  11.  
  12. condition = "Confield = 'EDIT' "
  13.  
  14. * Create a temporary database definition with 2 fields:
  15. *    Keyfield: a character field of length 10
  16. *    Confield: a character field of length 10
  17.  
  18. CREATE Temp
  19. APPEND BLANK
  20. REPLACE Field_name WITH 'Keyfield'
  21. REPLACE Field_type WITH 'C'
  22. REPLACE Field_len  WITH 10
  23. APPEND BLANK
  24. REPLACE Field_name WITH 'Confield'
  25. REPLACE Field_type WITH 'C'
  26. REPLACE Field_len  WITH 10
  27. CLOSE
  28.  
  29. * Create a database from the definition file.
  30.  
  31. CREATE Conorder FROM Temp
  32. ERASE  Temp.dbf
  33. USE    Conorder
  34.  
  35. * Set up the Index expression.
  36.  
  37. APPEND BLANK
  38. INDEX ON (IF(&condition, CHR(0) + Keyfield, Keyfield + CHR(0)));
  39.    TO Conorder
  40.  
  41. DO WHILE .T.
  42.    CLEAR
  43.    APPEND BLANK
  44.    @ 10, 5  SAY 'Enter a Keyfield'
  45.    @ 10, 60 GET Keyfield PICTURE '@!'
  46.    @ 12, 5  SAY 'Enter the Condition Field '
  47.    @ 13, 5  SAY 'Type "EDIT" to include in database'
  48.    @ 14, 5  SAY 'Type "QUIT" to quit program and list database'
  49.    @ 14, 60 GET Confield PICTURE '@!'
  50.    READ
  51.  
  52.    IF Confield = 'QUIT'
  53.       QUIT
  54.    ENDIF
  55.  
  56.    @ 16, 5 SAY 'Press Any Key To Display Database Records '
  57.    INKEY(0)
  58.    GOTO TOP
  59.    LIST Keyfield, Confield
  60.    INKEY(0)
  61. ENDDO
  62.